function PackRecord(params){ 
	 
}

PackRecord.Where = function(type,proxy){
	this.type = type;
	this.proxy=proxy;
	this.linked = null;
	this.set = null;
	if(this.type==0){
		this.set = new PackRecord.Where(1,true);
		this.set.linked = this;
	}
	this.getProxy = function(){
		var m = new PackRecord.Where(this.type);//当前的对像
		if(this.type==0){
			m.set = new PackRecord.Where(1,true);//set对象
			m.set.linked = m;
		}else{
			m.linked=this.linked;
			this.linked.linked=m;
		}
		return m;
	}
	this.data = {};
	this.put = function(key,value){
		this.data[key] = value;
	}
	this.get = function(key){
		return this.data[key];
	}
	/** 编号 [非空]       **/
	this.id=function(id){if(this.proxy)return this.getProxy().id(id);  this.put("id", id);return this;};
	/** and id is null */
	this.idNull=function(){if(this.proxy)return this.getProxy().idNull();if(this.get("idNot")==null)this.put("idNot", "");this.put("id", null);return this;};
	/** not .... */
	this.idNot=function(){if(this.proxy)return this.getProxy().idNot();this.put("idNot", "not");return this;};
	this.idNotNull=function(){if(this.proxy)return this.getProxy().idNotNull();this.put("idNot", "not");this.put("id", null);return this;};
	this.idNot=function(id){if(this.proxy)return this.getProxy().idNot(id);this.put("idNot", "not");this.put("id", id);return this;};
	/** and id <= ? */
	this.idMin=function(min){if(this.proxy)return this.getProxy().idMin(min);this.put("idMin", min);return this;};
	/** and id >= ? */
	this.idMax=function(max){if(this.proxy)return this.getProxy().idMax(max);this.put("idMax", max);return this;};
	this.idIn=function(ids){
		if(this.proxy)return this.getProxy().idIn(ids);  this.put("idIn", ids);return this;
	};	
	
	/** 领取人  [Member]      **/
	this.receiver=function(receiver){if(this.proxy)return this.getProxy().receiver(receiver);  this.put("receiver", receiver);return this;};
	/** and receiver is null */
	this.receiverNull=function(){if(this.proxy)return this.getProxy().receiverNull();if(this.get("receiverNot")==null)this.put("receiverNot", "");this.put("receiver", null);return this;};
	/** not .... */
	this.receiverNot=function(){if(this.proxy)return this.getProxy().receiverNot();this.put("receiverNot", "not");return this;};
	this.receiverNotNull=function(){if(this.proxy)return this.getProxy().receiverNotNull();this.put("receiverNot", "not");this.put("receiver", null);return this;};
	this.receiverNot=function(receiver){if(this.proxy)return this.getProxy().receiverNot(receiver);this.put("receiverNot", "not");this.put("receiver", receiver);return this;};
	this.receiverIn=function(ids){
		if(this.proxy)return this.getProxy().receiverIn(ids);  this.put("receiverIn", ids);return this;
	};	
	
	/** 所属红包  [RedPacket]      **/
	this.redEnvelopes=function(redEnvelopes){if(this.proxy)return this.getProxy().redEnvelopes(redEnvelopes);  this.put("redEnvelopes", redEnvelopes);return this;};
	/** and red_envelopes is null */
	this.redEnvelopesNull=function(){if(this.proxy)return this.getProxy().redEnvelopesNull();if(this.get("redEnvelopesNot")==null)this.put("redEnvelopesNot", "");this.put("redEnvelopes", null);return this;};
	/** not .... */
	this.redEnvelopesNot=function(){if(this.proxy)return this.getProxy().redEnvelopesNot();this.put("redEnvelopesNot", "not");return this;};
	this.redEnvelopesNotNull=function(){if(this.proxy)return this.getProxy().redEnvelopesNotNull();this.put("redEnvelopesNot", "not");this.put("redEnvelopes", null);return this;};
	this.redEnvelopesNot=function(redEnvelopes){if(this.proxy)return this.getProxy().redEnvelopesNot(redEnvelopes);this.put("redEnvelopesNot", "not");this.put("redEnvelopes", redEnvelopes);return this;};
	this.redEnvelopesIn=function(ids){
		if(this.proxy)return this.getProxy().redEnvelopesIn(ids);  this.put("redEnvelopesIn", ids);return this;
	};	
	
	/** 领取时间        **/
	this.timeToCollect=function(timeToCollect){if(this.proxy)return this.getProxy().timeToCollect(timeToCollect);  this.put("timeToCollect", timeToCollect);return this;};
	/** and time_to_collect is null */
	this.timeToCollectNull=function(){if(this.proxy)return this.getProxy().timeToCollectNull();if(this.get("timeToCollectNot")==null)this.put("timeToCollectNot", "");this.put("timeToCollect", null);return this;};
	/** not .... */
	this.timeToCollectNot=function(){if(this.proxy)return this.getProxy().timeToCollectNot();this.put("timeToCollectNot", "not");return this;};
	this.timeToCollectNotNull=function(){if(this.proxy)return this.getProxy().timeToCollectNotNull();this.put("timeToCollectNot", "not");this.put("timeToCollect", null);return this;};
	this.timeToCollectNot=function(timeToCollect){if(this.proxy)return this.getProxy().timeToCollectNot(timeToCollect);this.put("timeToCollectNot", "not");this.put("timeToCollect", timeToCollect);return this;};
	/** and time_to_collect >= ? */
	this.timeToCollectStart=function(start){if(this.proxy)return this.getProxy().timeToCollectStart(start);this.put("timeToCollectStart", start);return this;};			
	/** and time_to_collect <= ? */
	this.timeToCollectEnd=function(end){if(this.proxy)return this.getProxy().timeToCollectEnd(end);this.put("timeToCollectEnd", end);return this;};
	
	
	
	this.add=function(key,value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	this.desc=function(sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	this.asc=function(sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	this.definex=function(sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	
	/** 获取所有红包领取记录 **/
	this.list=function(size){
		this.data.size = size;
		var protocol = ux.ajax("/admin/products/packrecord.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list)return protocol.data.list;
		return [];
	}
	/** 获取红包领取记录分页 **/
	this.page=function(page,size){
		this.data.size = size;
		this.data.page = page;
		var protocol = ux.ajax("/admin/products/packrecord.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data)return data;
		return {list:[]};
	}
	/** 根据查询条件取红包领取记录 **/
	this.get=function(){
		this.data.size = 1;
		var protocol = ux.ajax("/admin/products/packrecord.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list && protocol.data.list.length==1)return protocol.data.list[0]; 
		return null;
	}
}

PackRecord.get = function(id){
	var protocol = ux.ajax("/admin/products/packrecord.get.do",{id:id});
	if(!protocol)return null;
	if(protocol.data)return protocol.data.packRecord;
	return null;
}

PackRecord.where = new PackRecord.Where(0,true);